<style>
    .panel-body{
        position: relative;
    }
    .gearMenu{
        width: 100px;
        margin-top: 0;
        margin-left: 72%;
        position: absolute;
        padding-right: 30px;
        /*background: palegoldenrod;*/
    }
    .gear{
        width: 100%;
        height: 30px;
        font-size: 25px;
        font-weight: bolder;
        color: white;
        /*background: palegreen;*/
        text-shadow: 0 0 3px #003399;
        text-align: right;
    }/*齿轮绝对定位右上角*/
    #menuNav{
        width: 100px;
        height: auto;
        /*background: rosybrown;*/
        margin-top: 1px ;
        display: none;
        padding: 1px;
        border: 1px solid #CCCCCC;
        box-sizing: border-box;

    }/*齿轮点击菜单*/
    #menuNav a{
        width: 100%;
        border: none;
        border-radius: 0;
        margin-top: -1px;
        text-align: left;
    }
    .photo{
        width: 60px;
        height: 60px;
        border-radius: 50%;
        margin: 1px auto 0;
        background: palegoldenrod;
    }/*头像*/
    .photo img{
        width: 100%;
        height: 100%;
        border-radius: 50%;
    }/*头像图片*/
    .page-header{
        text-align: center;
    }/*用户名*/
    .user_space_userinfo{
        width: 90%;
        height: auto;
        margin: 0 auto;
        font-size: 12px;
        columns: 200px 3;
        line-height: 25px;
        -webkit-columns: 200px 3; /* Safari and Chrome */
        -moz-columns: 200px 3; /* Firefox */
        /*background: palegreen;*/
    }/*用户详情*/
</style>
<script>
    function jumpto(url){
        window.location.href=url+'#info';
    }
</script>
<div class="panel panel-default">
    <div class="panel-body">
        {if $GLOBALS['TS_USER']}
        <div class="gearMenu">
        <div class="gear">&#9881;</div>

        <div id="menuNav">
            {if $GLOBALS['TS_USER']['isadmin']!=0&&$strUser[userid] != $TS_USER[userid]}
            {if $ac=='duty'}
            <a class="btn btn-default btn-sm" onclick="showdutyform()">代记时</a>
            <a class="btn btn-default btn-sm" data-toggle="modal" data-target="#do_date_form1">导出时长</a>
            {/if}
            <a class="btn btn-default btn-sm" href="{tsUrl('my','setting',array('ts'=>face,'uid'=>$strUser[userid]))}">修补头像</a>
            {if $strUser['isrenzheng']==0}
            <a class="btn btn-default btn-sm" href="javascript:void('0');" onclick="renzheng('{$strUser[userid]}')">认证成员</a>
            {else}
            {if $strUser['count_duty']==0}
            <a class="btn btn-default btn-sm" href="javascript:void('0');" onclick="cancelrenzheng('{$strUser[userid]}')">取消认证</a>
            {/if}
            {/if}

            {if $strUser['isto']==0}
            <a class="btn btn-default btn-sm" href="javascript:void('0');" onclick="to('{$strUser[userid]}')">设为拓手</a>
            {else}
            <a class="btn btn-default btn-sm" href="javascript:void('0');" onclick="deto('{$strUser[userid]}')">撤销拓手</a>
            {/if}
            {if $strUser['istui']==0}
            <a class="btn btn-default btn-sm" href="javascript:void('0');" onclick="tui('{$strUser[userid]}')">设为推手</a>
            {else}
            <a class="btn btn-default btn-sm" href="javascript:void('0');" onclick="detui('{$strUser[userid]}')">撤销推手</a>
            {/if}
            {/if}
            {if ($GLOBALS['TS_USER']['isadmin']||$leader)&&$strUser[userid] != $TS_USER[userid]}
            {if $strUser['issink']==0}
            <a class="btn btn-default btn-sm" href="javascript:void('0');" onclick="sink('{$strUser[userid]}')">流失</a>
            {else}
            <a class="btn btn-default btn-sm" href="javascript:void('0');" onclick="desink('{$strUser[userid]}')">回归</a>
            {/if}
            {/if}


            {if $strUser[userid] != $TS_USER[userid]}
            {if $strUser[isfollow]}
            <a class="btn btn-default btn-sm" href="javascript:void('0');" onclick="unfollow('{$strUser['userid']}','{$_SESSION['token']}');">ta不是我的先导</a>
            {else}
            {if  ($my[follow_uid]==0)&&($strUser['follow_uid']!=$TS_USER[userid])}
            <a class="btn btn-success btn-sm" href="javascript:void('0')" onclick="follow('{$strUser['userid']}','{$_SESSION['token']}');">ta是我的先导</a>
            {/if}
            {/if}
            {if $strUser[iscoach]&&$strCoach['status']!=-1&&$TS_USER['count_duty']<5}
            {if !$strCoach&&$count_stu<6}
            <a class="btn btn-default btn-sm" href="javascript:void('0');"  onclick="tsPost('index.php?app=user&ac=do&ts=docoach&js=1',{'type':'1','userid':'{$userid}'})" >设为教练</a>
            {else}
            <a class="btn btn-default btn-sm" href="javascript:void('0')"  onclick="tsPost('index.php?app=user&ac=do&ts=docoach&js=1',{'type':'0','userid':'{$userid}'})" >取消教练</a>
            {/if}
            {/if}
            {if $arrCoach}
            <a class="btn btn-default btn-sm" href="javascript:void('0');"  onclick="tsPost('index.php?app=user&ac=do&ts=docoach&js=1',{'type':'-1','userid':'{$userid}'})" >解除教练</a>
            {/if}

            <a href="{tsUrl('user','message',array(ts=>add,touserid=>$strUser[userid]))}" rel="nofollow" class="btn btn-default btn-sm">发消息</a>
            {if $iscard}
            <a href="{tsUrl('user','message',array(ts=>addcard,touserid=>$strUser[userid]))}" rel="nofollow" class="btn btn-default btn-sm">发贺卡</a>
            {/if}
            {else}

            {if $TS_USER['iscoach']==1}
            <a class="btn btn-default btn-sm" href="javascript:void('0');"  onclick="tsPost('index.php?app=user&ac=do&ts=setcoach&js=1',{'type':'-1'})" >辞去教练</a>
            {/if}
            {if $TS_USER['iscoach']==-1}
            <a class="btn btn-default btn-sm" href="javascript:void('0');"  onclick="tsPost('index.php?app=user&ac=do&ts=setcoach&js=1',{'type':'1'})" >担任教练</a>
            {/if}
            <a class="btn btn-default btn-sm"  href="{tsUrl('user','pay')}">财务明细</a>
            <a class="btn btn-default btn-sm"  href="{tsUrl('my','setting',array(ts=>base))}">修改资料</a>
            {/if}
        </div>


        </div>
        {/if}
        <div class="photo">
            <img class="img-rounded" title="{$strUser[username]}" alt="{$strUser[username]}" src="{$strUser[face]}">

        </div>


        <div class="page-header">
            <h1><span id="username" {if $GLOBALS['TS_USER']['isadmin']=='1'}onclick='showname()'{/if}>
                {$strUser['username']}
                </span>
                <span id="rename" style="display: none"> <input type="text" id="newname" value="{$strUser['username']}" onmouseout='rename()'></span>
                <span>
                <small {if $strUser['issink']==1}style='color:orange' title='流失'{/if}>
                 {if $strUser['isstock']==1}
                    &nbsp;馆东
                 {/if}
                 {if $strUser['isstock']==-1}
                    &nbsp;候选馆东
                 {/if}
                 {if $strUser['isvo']}
                    {if $strUser['isrenzheng']==1}
                        {if $strUser['count_duty']==0}
                          &nbsp;候任馆员
                        {else}
                              {if $strUser['count_duty']<12}
                                &nbsp;试用馆员
                             {else}
                               &nbsp;正式馆员
                             {/if}
                         {/if}
                    {else}
                        {if $strUser['isvo']==1}
                        &nbsp;候选馆员
                        {/if}

                    {/if}
                 {if $strUser['isto']==1}
                    &nbsp;拓手
                 {/if}
                 {if $strUser['istui']==1}
                    &nbsp;推手
                 {/if}
                 {if $strUser['iscoach']==1}
                    &nbsp;教练
                 {/if}

                {/if}


            </h1>
        </div>


        <div class="user_space_userinfo">
            <div><i class="fa fa-bookmark-o" ></i> UID：{$strUser[userid]} </div>
            <div><i class="fa fa-bookmark-o" ></i> 注册：{php echo date('Y-m-d',$strUser[addtime])} </div>
            <div><i class="fa fa-bookmark-o" ></i> 登录：{php echo date('Y-m-d',$strUser[uptime])} </div>
            {if $strUser['birth']&&($strUser['isadmin']!=0||$GLOBALS['TS_USER']['userid']==$userid||$leader==1)}
            <div><i class="fa fa-bookmark-o" ></i> 生日：{php echo date('Y-m-d',$strUser[birth])} </div>
            {/if}
            <div><i class="fa fa-bookmark-o" ></i> 性别：{$strUser['sex']}</div>
            {if $strUser['province']}
            <div><i class="fa fa-bookmark-o" ></i> 居住地：{$strUser['province']} {$strUser['city']}</div>
            {/if}



            <div><i class="fa fa-bookmark-o" ></i> 等级：<a href="{tsUrl('user','role')}">{$strUser['rolename']}</a></div>

            {if $strUser['isadmin']!=0}
            <div><i class="fa fa-bookmark-o" ></i> 权限：{if $strUser['isadmin']==1}管理员{else}协理员{/if}</div>
            {/if}

            <div><i class="fa fa-bookmark-o" ></i> 积分：{$strUser['count_score']}</div>

            <div><i class="fa fa-bookmark-o" ></i> 服务：{$strUser['sum_duty']}次/{$strUser['count_duty']}小时
            {if $GLOBALS['TS_USER']['isadmin']=='1'}(
            {if $strUser['deoffice']}
            <a style="color:black;font-size: 10px" href="javascript:void('0');" onclick="office('{$strUser[userid]}')">时长不导出</a>
            {else}
            <a style="color:black;font-size: 10px" href="javascript:void('0');" onclick="deoffice('{$strUser[userid]}')">时长导出</a>
            {/if})
            {/if}
            </div>
            <div><i class="fa fa-bookmark-o" ></i> 所在团队：
                {if $GLOBALS['TS_USER']['isadmin']=='1'}  <a style="color:black"  data-toggle="modal" data-target="#do_group_form">{/if}{if  $strUser['groupname']}<a href="#"  id="tips1"  rel="popover" data-placement="auto left" data-content="{$strUser['groupname']}" >{php echo cututf8($strUser['groupname'],0,10)} </a> {else}不详{/if}{if $GLOBALS['TS_USER']['isadmin']=='1'}{/if}</a>
             </div>
            <div><i class="fa fa-bookmark-o" ></i> 先导：{if $strUser['follow_uid']>1}<a class="nbg" href="{tsUrl('user','duty',array('id'=>$followUser['userid']))}">
                {$followUser['username']}
            </a>{else}{if $strUser['follow_uid']==1 }无{if $strUser[userid] == $TS_USER[userid]}<a onclick="resetfollow()" >（重置）</a>{/if}{else}未设置（<a href="{tsUrl('group','topic',array('id'=>51))}">如何设置</a>）{/if}{/if}</div>
            <div><i class="fa fa-bookmark-o" ></i> 后继：
                <a href="{tsUrl('user','followed',array('id'=>$strUser['userid']))}#info">{$strUser['count_followed']} </a>
            </div>
            <div><i class="fa fa-bookmark-o" ></i> 伯乐指数：{$strUser['count_duty_follow']}</div>
            {if $count_coach}
            <div><i class="fa fa-bookmark-o" ></i> TA的教练：
                <a href="{tsUrl('user','coach',array('id'=>$strUser['userid']))}#info">{$count_coach} </a>
            </div>
            {/if}
            {if $count_student}
            <div><i class="fa fa-bookmark-o" ></i> TA的学员：
                <a href="{tsUrl('user','student',array('id'=>$strUser['userid']))}#info">{$count_student} </a>
            </div>
            {/if}
            <div><i class="fa fa-bookmark-o" ></i> 加入小组：
                <a href="{tsUrl('user','space',array('id'=>$strUser['userid']))}#info">{$strUser['count_group']} </a>
            </div>

            {if $GLOBALS['TS_USER']['isadmin']!=0||$GLOBALS['TS_USER']['userid']==$userid||$leader==1}
            {if $strUser['phone']}
            <div><i class="fa fa-bookmark" ></i> 手机号：
                {$strUser['phone']}
            </div>
            {/if}

            <div><i class="fa fa-bookmark" ></i> 所属组织：
                <a style="color:black"  data-toggle="modal" data-target="#do_org_form"> {if $strUser['orgname']}{$strUser['orgname']}{else}微澜图书馆{/if}</a>
            </div>
            {if  $leadership}

            <div><i class="fa fa-bookmark" ></i> 可担任{$leadership}</div>
            {/if}
            {if $strUser['how']}
            <div><i class="fa fa-bookmark" ></i> 来历：{$strUser['how']}</div>
            {/if}

            {if $strUser['about']}
            <div><i class="fa fa-bookmark" ></i> 自我介绍：{$strUser['about']}</div>
            {/if}
            {/if}
            {if  $strUser['comefrom1']}
            <div><i class="fa fa-bookmark-o" ></i> 身份： $strUser['comefrom1']</div>
            {/if}
            {if  $strUser['skill1']}
            <div><i class="fa fa-bookmark-o" ></i> 技能： $strUser['skill1']</div>
            {/if}
            {if $GLOBALS['TS_USER']['isadmin']!=0||$GLOBALS['TS_USER']['userid']==$userid||$leader==1}
            <div>注：<i class="fa fa-bookmark" ></i> 表示仅本人及总馆、分馆管理层可见。</div>
            {/if}
        </div>
    </div>
</div>




<div id="do_org_form" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true" >
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h5 class="modal-title">选择机构</h5>
            </div>
            <div class="modal-body" >
                <form  id="set_org" class="form-horizontal"  method="post" action="">


                    <div class="form-group">
                        <div class="col-sm-12">
                            <select  name="orgid" id="orgid" class="form-control">
                                <option></option>
                                {loop $arrOrg $key $item}
                                <option value="{$item['orgid']}" {if $item['orgid']==$strUser['orgid']}selected{/if}>{$item['orgname']}</option>
                                {/loop}
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-sm-offset-2 col-sm-10">
                            <button type="submit" class="btn btn-success">提交</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

<div id="do_group_form" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true" >
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h5 class="modal-title">选择团队</h5>
            </div>
            <div class="modal-body" >
                <form  id="set_group" class="form-horizontal"  method="post" action="">


                    <div class="form-group">
                        <div class="col-sm-12">
                            <select  name="groupid" id="groupid" class="form-control" multiple>
                                <option></option>
                                {loop $arrGroup $key $item}
                                <option value="{$item['groupid']}" {if in_array($item['groupid'],$strUser['group'])}selected{/if}>{$item['groupname']}</option>
                                {/loop}
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-sm-offset-2 col-sm-10">
                            <button type="submit" class="btn btn-success">提交</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<script>

    function showname(){
        $('#username').css('display','none');
        $('#rename').css('display','block');
    }

    //改名
    function rename(){

        var username  = $('#newname').val();
        var userid = {php echo $userid };

        $.ajax({
            type: "POST",
            url: siteUrl+"index.php?app=user&ac=do&ts=setname",
            data: "userid="+userid+"&username="+username,
            beforeSend:function(){
            },
            success:function(result){
                if(result == '1'){
                    window.location.reload();
                }
            }
        });
    }
    //认证为馆员
    function renzheng(userid){


        if (confirm('认证此人为馆员吗？')) {

            $.ajax({
                type: "POST",
                url: siteUrl+"index.php?app=user&ac=do&ts=renzheng",
                data: "userid="+userid,
                beforeSend:function(){
                },
                success:function(result){
                    if(result == '1'){
                        window.location.reload();
                    }
                }
            });

        }
    }

    //取消馆员认证
    function cancelrenzheng(userid){


        if (confirm('取消此人的馆员认证吗')) {

            $.ajax({
                type: "POST",
                url: siteUrl+"index.php?app=user&ac=do&ts=cancelrenzheng",
                data: "userid="+userid,
                beforeSend:function(){
                },
                success:function(result){
                    if(result == '1'){
                        window.location.reload();
                    }
                }
            });

        }
    }

    //标记流失
    function sink(userid){

        if (confirm('标记此人为流失吗？')) {

            $.ajax({
                type: "POST",
                url: siteUrl+"index.php?app=user&ac=do&ts=sink",
                data: "userid="+userid,
                beforeSend:function(){
                },
                success:function(result){
                    if(result == '1'){
                        window.location.reload();
                    }
                }
            });

        }
    }
    //标记回归
    function desink(userid){

        if (confirm('标记此人为回归吗？')) {

            $.ajax({
                type: "POST",
                url: siteUrl+"index.php?app=user&ac=do&ts=desink",
                data: "userid="+userid,
                beforeSend:function(){
                },
                success:function(result){
                    if(result == '1'){
                        window.location.reload();
                    }
                }
            });

        }
    }
    //标记拓手
    function to(userid){

        if (confirm('标记此人为拓手吗？')) {

            $.ajax({
                type: "POST",
                url: siteUrl+"index.php?app=user&ac=do&ts=to",
                data: "userid="+userid,
                beforeSend:function(){
                },
                success:function(result){
                    if(result == '1'){
                        window.location.reload();
                    }
                }
            });

        }
    }
    //撤销拓手
    function deto(userid){

        if (confirm('撤销此人拓手身份吗？')) {

            $.ajax({
                type: "POST",
                url: siteUrl+"index.php?app=user&ac=do&ts=deto",
                data: "userid="+userid,
                beforeSend:function(){
                },
                success:function(result){
                    if(result == '1'){
                        window.location.reload();
                    }
                }
            });

        }
    }
    //标记推手
    function tui(userid){

        if (confirm('标记此人为推手吗？')) {

            $.ajax({
                type: "POST",
                url: siteUrl+"index.php?app=user&ac=do&ts=tui",
                data: "userid="+userid,
                beforeSend:function(){
                },
                success:function(result){
                    if(result == '1'){
                        window.location.reload();
                    }
                }
            });

        }
    }
    //撤销推手
    function detui(userid){

        if (confirm('撤销此人推手身份吗？')) {

            $.ajax({
                type: "POST",
                url: siteUrl+"index.php?app=user&ac=do&ts=detui",
                data: "userid="+userid,
                beforeSend:function(){
                },
                success:function(result){
                    if(result == '1'){
                        window.location.reload();
                    }
                }
            });

        }
    }
    //计入官方平台
    function office(userid){


        if (confirm('确定此人服务时长导入官方平台吗？')) {

            $.ajax({
                type: "POST",
                url: siteUrl+"index.php?app=user&ac=do&ts=office",
                data: "userid="+userid,
                beforeSend:function(){
                },
                success:function(result){
                    if(result == '1'){
                        window.location.reload();
                    }
                }
            });

        }
    }

    //不计入官方平台
    function deoffice(userid){


        if (confirm('确定此人服务时长不导入官方平台吗')) {

            $.ajax({
                type: "POST",
                url: siteUrl+"index.php?app=user&ac=do&ts=deoffice",
                data: "userid="+userid,
                beforeSend:function(){
                },
                success:function(result){
                    if(result == '1'){
                        window.location.reload();
                    }
                }
            });

        }
    }


    //计入官方平台
    function setStock(userid){

        if (confirm('确定要设为月捐人吗？')) {
            $.ajax({
                type: "POST",
                url: siteUrl+"index.php?app=user&ac=do&ts=setstock",
                data: "userid="+userid,
                beforeSend:function(){
                },
                success:function(result){
                    if(result == '1'){
                        window.location.reload();
                    }
                }
            });

        }
    }

    //不计入官方平台
    function deStock(userid){

        if (confirm('确定要取消月捐人吗？')) {
            $.ajax({
                type: "POST",
                url: siteUrl+"index.php?app=user&ac=do&ts=destock",
                data: "userid="+userid,
                beforeSend:function(){
                },
                success:function(result){
                    if(result == '1'){
                        window.location.reload();
                    }
                }
            });

        }
    }



    //重置先导
    function resetfollow(){


        if (confirm('要重置你的先导吗')) {

            $.ajax({
                type: "POST",
                url: siteUrl+"index.php?app=user&ac=do&ts=resetfollow",
                data: "userid="+userid,
                beforeSend:function(){
                },
                success:function(result){
                    if(result == '1'){
                        window.location.reload();
                    }
                }
            });

        }
    }

    $(function(){
        $('#set_org').on('submit', function(e) {
            var orgid  = $('#orgid').val();
            var userid = {php echo $userid };

            $.ajax({
                type: "POST",
                url: siteUrl+"index.php?app=user&ac=do&ts=setorg",
                data: "userid="+userid+"&orgid="+orgid,
                beforeSend:function(){
                },
                success:function(result){
                    if(result == '1'){
                        window.location.reload();
                    }
                }
            });

        });

    });


    $(function(){
        $('#set_group').on('submit', function(e) {
            var groupid  = $('#groupid').val();
            var userid = {php echo $userid };

            $.ajax({
                type: "POST",
                url: siteUrl+"index.php?app=user&ac=do&ts=setgroup",
                data: "userid="+userid+"&groupid="+groupid,
                beforeSend:function(){
                },
                success:function(result){
                    if(result == '1'){
                        window.location.reload();
                    }
                }
            });

        });

    });



    /*齿轮点击事件*/
    $(".gear").click(function(event){
        $('#menuNav').css('display','block');
        event.stopPropagation();
    });/*点击字体图标显示菜单菜单消失*/
    $(document).click(function(){
        $("#menuNav").css('display','none');
    });/*点击其他地方菜单消失*/

</script>

